package org.javaboy.vhr.service;

import org.javaboy.vhr.mapper.PositionMapper;
import org.javaboy.vhr.model.Position;
import org.javaboy.vhr.model.RespBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * @Author Willie Chen
 * @Description
 * @Date 2019/10/20
 * @Param $param
 **/
@Service
public class PositionService {

    @Autowired
    PositionMapper positionMapper;

    public List<Position> getAllPositions(){

      return positionMapper.getAllPositions();

    };

    public Integer addPosition(Position position) {
        position.setEnabled(true);
        position.setCreateDate(new Date());
        return  positionMapper.insertSelective(position);
    }

    public Integer updatePositions(Position position) {

        return  positionMapper.updateByPrimaryKeySelective(position);

    }

    public Integer deletePositionById(Integer id) {
        return  positionMapper.deleteByPrimaryKey(id);
    }

    public Integer deletePositionsByIds(Integer[] ids) {
        return  positionMapper.deletePositionsByIds(ids);
    }
}
